package com.xkcoding.upload.service.impl;

import com.xkcoding.upload.service.DownloadService;
import com.xkcoding.upload.utils.FileUtil;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class DownloadServiceImpl implements DownloadService {
    @Override
    public void download(List<String> queryAll, HttpServletResponse response) throws IOException {
        
        List<Map<String, Object>> list = new ArrayList<>();
        for (String str : queryAll) {
            Map<String, Object> map = new LinkedHashMap<>();
            map.put("用户名", str);
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);

    }
}
